import {Component, Inject, OnInit} from '@angular/core';
import {MD_DIALOG_DATA, MdDialogRef} from '@angular/material';

@Component({
  selector: 'app-tip',
  templateUrl: './tip.component.html',
  styleUrls: ['./tip.component.scss']
})
export class TipComponent implements OnInit {


  tipText:any = "确认操作？";
  timeout:boolean = false; //是否倒计时关闭 默认否
  needEdit:boolean = false;//是否需要输入内容 默认否

  remark:any="";

  config:any=[]
  constructor(public dialogRef: MdDialogRef<TipComponent>,@Inject(MD_DIALOG_DATA) data: any) {
    this.config = data
    // this.config = dialogRef._containerInstance.dialogConfig.data||{};
  }

  ngOnInit() {
    console.log(this.config);
    this.tipText = this.config.tipText;
    this.timeout = this.config.timeout;
    this.needEdit = this.config.needEdit;

    // this.tipText = this.dialogRef.componentInstance.tipText;
    // this.timeout = this.dialogRef.componentInstance.timeout;
    // this.needEdit = this.dialogRef.componentInstance.needEdit;
    if(this.timeout){
      setTimeout((data)=>{
        this.dialogRef.close({status:false})
      },1500)
    }
  }

}
